package gtkwire.widget;

import gtkwire.listener.MenuSelectionListener;
import gtkwire.listener.connector.MenuSelectionListenerFilter;
import gtkwire.GladeKey;

/**
*A widget used for item in menus. MORE METHODS
*/
public class GtkMenuItem extends GtkItem
{
	protected String label;

	public GtkMenuItem( String label )
	{
		super();
		this.widgetType = WT_GtkMenuItem;
		this.label = label;
		gtkCreate();
	}

	public GtkMenuItem( String name, GladeKey key )
	{
		super( name, key );
		this.widgetType = WT_GtkMenuItem;
	}

	/**
	*Adds listener that is notified each time menu item selection is made.
	*/
	public void addMenuSelectionListener( MenuSelectionListener l )
	{
		MenuSelectionListenerFilter ml = new MenuSelectionListenerFilter( l );
		ml.addFilteringName( name );
		app().addListener( ml );
	}

	protected String[] getCreateData()
	{
		if( label == null ) return null;
		String[] msg = { label };
		return msg;
	}

}//end class
